package com.leyu.mall.admin.cms.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.leyu.mall.domain.cms.CmsShopConfig;
import com.leyu.mall.service.cms.ICmsShopConfigService;
/**
 * 〈一句话功能简述〉 〈功能详细描述〉
 * @author OOKK
 * @see [相关类/方法]（可选）
 * @since [产品/模块版本] （可选）
 */
@Controller
@Scope(value = "prototype")
@RequestMapping("admin/shopconfig")
public class ShopConfigController
{

	@Autowired
	private ICmsShopConfigService	cmsShopConfigService;
	
	@RequestMapping(value = "", method = RequestMethod.GET)
	public String index(Model model) throws Exception
	{
		CmsShopConfig shopconfig = this.cmsShopConfigService.getCmsShopConfig(1L);
		
		model.addAttribute("shopconfig",shopconfig);
		return "admin/shopconfig.html";
	}
	
	@RequestMapping(value = "save", method = RequestMethod.POST)
	public String save(Model model,CmsShopConfig shopconfig) throws Exception
	{
		 
//		CmsShopConfig shopconfig = this.cmsShopConfigService.getCmsShopConfig(1L);
		this.cmsShopConfigService.addCmsShopConfig(shopconfig);
		model.addAttribute("shopconfig",shopconfig);
		return "admin/shopconfig.html";
	}
	
}
